<template>
    <div id="dd">
        <div class="tm">
        <br> 
        <div class="tmm">
            {{index}}/{{tim.length}}
            <br>
            <br>
            <br>
            {{tim.wt}}
            </div>
          <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
           <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        </div>
        <div class="xz">
        <br>
        <br>
        <br>
        <br>
 <table class="tab">
            <tr>
                <td class="tdd">
                     <el-radio v-model="tim.uid"  :label="1" border>{{tim.a}}</el-radio>
                </td>
                  <td class="tdd">
                       <el-radio v-model="tim.uid" :label="2" border>{{tim.b}}</el-radio>
                </td>
                  <td class="tdd">
                        <el-radio v-model="tim.uid"  :label="3" border>{{tim.c}}</el-radio>
                </td>
            </tr>
            <br>
            <br>
              <tr>
                <td class="tdd">
                     <el-radio v-model="tim.uid" :label="4" border>{{tim.d}}</el-radio>
                </td>
                  <td class="tdd">
                        <el-radio v-model="tim.uid" :label="5" border>{{tim.e}}</el-radio>
                </td>
                  <td class="tdd">
                        <el-button type="primary" @click="ti()" id="butt"  round>下一题捏</el-button>
                </td>
            </tr>
        </table>
        </div>
    </div>
</template>
<script>
export default {
    data(){
        return{
            odex:0,
            index:0,
            tim:{wt:"",a:"",b:"",c:"",d:"",uid:"",length:""},
            yanxu:[
                {wt:"1.头痛?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"2.神经过敏，心中不踏实?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"3.头脑中有不必要的想法?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"4.头晕和昏倒?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"5.对异性兴趣减退?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"6.对旁人责备求全?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"7.感到别人能控制你的想法?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"8.责怪别人制造麻烦?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"9.忘记性大?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"10.担心自己的服饰整齐及仪态端正?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"11.容易烦躁和激动?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"12.胸痛?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"13.害怕空旷的场所或街道?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"14.感到自己的精力下降，活动减慢?",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"15.想结束自己的生命",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"16.听到旁人听不到的声音",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"17.发抖",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"18.感到大多数人不可信任",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1},
                {wt:"19.胃口不好",a:"a.没有",b:"b.很少",c:"c.有时",d:"d.经常",e:"e.总是",uid:1}
            ],
            tryuanxu:[
            ],
            num:0
        }
    },
    methods:{
        ti(){
            if(this.index>=this.yanxu.length-1){
                document.getElementById("butt").innerText="完成答题";
            }
            if(this.index>=this.yanxu.length){
                this.index=this.yanxu.length-1;
            }
           console.log(this.index+"头")
            this.tim=this.yanxu[this.index]
            this.tim.length=this.yanxu.length;
            this.index++
            this.tryuanxu[this.odex]=this.yanxu[this.odex].uid
            console.log(this.tryuanxu)
             if(this.odex<this.yanxu.length-1){
                this.odex++
            }else{
                this.over();
            }
            console.log(this.index+"尾巴")
        },
         over(){
             console.log(this.tryuanxu);
             for(var i=0;i<this.tryuanxu.length;i++){
                 this.num+=this.tryuanxu[i];
             }
             this.axios.post('abb/tim',{list:this.num,dj:3}).then(response=>{
                })
         }
    },
    created(){
            this.tim=this.yanxu[this.index]
            this.tim.length=this.yanxu.length;
            console.log(this.tim)
            this.index++

    }
}
</script>
<style>
    .tm{
        height: 50%;
        width: 100%;
        background-color:aquamarine
    }
    .xz{
        position:absolute;
        left:10%;
        top: 40%;
        width: 80%;
        height: 50%;
        background-color:wheat
    }
    .tmm{
        font-size:40px;
        color:white
    }
      .tab{
        width:100%;
    }
</style>
